﻿<%@	Page Language="C#" Theme="WebMaster" MasterPageFile="~/WebMaster/MasterPage.master"
	CodeFile="Photos.aspx.cs" Inherits="Admin_Photos_aspx" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register TagPrefix="FTB" Namespace="FreeTextBoxControls" Assembly="FreeTextBox" %>
<%@ Register Src="~/WebMaster/Controls/Title.ascx" TagName="Title" TagPrefix="uc" %>

<asp:content id="Content1" contentplaceholderid="PageContent" runat="server">
<uc:Title ID="Title1" runat="server" ResourceKey='' strMsg='Thêm hình ảnh'/>
	

<div align="center">
    <asp:Panel Width="450" runat="server" ID="PanelPhoto" GroupingText="Thêm hình ảnh mới">
        <table cellpadding="7" align="center" border="0">
            <tr>
                <td colspan="2">
                    <asp:ValidationSummary runat="server" ValidationGroup="PhotoAdd" ID="valChangePasswordSummary"  ShowMessageBox="true" ShowSummary="false" />
                    <asp:Label runat="server" ID="lblMsg" ForeColor="#E6CD84"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right">Album:</td>
                <td align="left">
                    <asp:Label Font-Bold="true" ForeColor="blue" runat="server" ID="lblAlbumsName"></asp:Label>
                </td>
            </tr>
            <tr>
                <td align="right" width="80px">Photo:</td>
                <td align="left">
                    <asp:FileUpload ID="PhotoFile" Runat="server" />
                    <asp:Image runat="server" ID="ImageFile" />
                    <asp:HiddenField runat="server" ID="HPhotoFile" />
                    <asp:RequiredFieldValidator SetFocusOnError="true" ID="fqfPhoto" ForeColor="#E6CD84" ValidationGroup="PhotoAdd" Runat="server" ErrorMessage="Chưa chọn hình cần Upload." ControlToValidate="PhotoFile" Display="none"/>
                </td>
            </tr>
            <tr>
                <td align="right">Tiêu đề:</td>
                <td align="left"><asp:TextBox ID="PhotoTitle" Runat="server" Width="326" /></td>
            </tr>
            <tr>
                <td align="right" valign="top">Mô tả: </td>
                <td align="left">
                    <asp:TextBox ID="txtDesc" Runat="server" Width="326" TextMode="MultiLine" Rows="6"  />
                </td>
            </tr>
            <tr>
                <td colspan="2" align="right">
                    <asp:Button ID="AddNewPhotoButton" Text="Save" ValidationGroup="PhotoAdd" OnClick="PhotoAdd_Click" Runat="server" />
                </td>
            </tr>
        </table>  
    </asp:Panel>
    
     
</div>





<table border="0" width="100px" cellpadding="0"  cellspacing="0" align="center">
    <tr>
        <td style="padding-top:5pt;" align="center">
            <asp:GridView runat="server" Width="700px" HorizontalAlign="Center" 
                ID="GridViewItem" 
                DataSourceID="ItemDataSource"
                AutoGenerateColumns="false" 
                AllowPaging="True" 
                AllowSorting="True" 
                PagerSettings-Mode="NumericFirstLast"
                GridLines="none">
                <Columns>
                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                        HeaderText="Delete">
                        <HeaderTemplate>
                            <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect" ToolTip='<%# Eval("FileID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                                                        
                    <asp:TemplateField HeaderText="Hình" 
                        HeaderStyle-Width="120" ItemStyle-Width="120"
                        HeaderStyle-HorizontalAlign="Center"
                        ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate><%=ResourceManager.GetString("Image") %></HeaderTemplate>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td align="center" width="110px" height="110px" style="border:solid 1px #cccccc; cursor:pointer">
                                        <a href="Photos.aspx?FileID=<%#Eval("FileID")%>&Action=Edit&CateID=<%#Eval("CateID")%>">
                                            <img border="0" src='<%=Globals.ApplicationPath %>Photos/Image.ashx?Size=M&ImageUrl=<%# Eval("FileName") %>' />   
                                        </a>
                                    </td>
                                </tr>
                            </table>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Title" 
                        HeaderStyle-Width="200" ItemStyle-Width="200" ItemStyle-Height="40"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <ItemTemplate>
                            <%# Eval("Title") %>
                            <br />
                            <%# Eval("Title") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    
                    <asp:TemplateField HeaderStyle-Width="40px" ItemStyle-Width="40px" HeaderText="Edit"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate><%=ResourceManager.GetString("Edit") %></HeaderTemplate>
                        <ItemTemplate>
                            <asp:HyperLink runat="server" ID="lnkEdit" ImageUrl="~/WebMaster/Images/Edit.gif" NavigateUrl='<%# "Photos.aspx?FileID=" + (int)Eval("FileID")+"&Action=Edit&CateID="+ (int)Eval("CateID")  %>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    <table align="center" width="100%" border="0" bgcolor="#ffffcc" bordercolorlight="#0099cc"  bordercolor="#0099cc">
                        <tr>
                            <td height="50" align="center">
                                <div align="center" id="EmptyData">Không có hình ảnh nào trong Album này.</div>
                            </td>   
                        </tr>
                    </table>
                </EmptyDataTemplate>
            </asp:GridView>            
        </td>
    </tr>
    <tr>
        <td align="right">
        <br />
        <asp:Button runat="server" ID="btDelete" Text=" Delete " OnClick="btDelete_Click" /></td>
    </tr>
</table>

	
	<asp:ObjectDataSource ID="ItemDataSource" Runat="server" 
	    TypeName="webapp4U.BOL.File"
		SelectMethod="GetFileByCateID">
		<SelectParameters>
			<asp:QueryStringParameter Name="CateID" Type="Int32" QueryStringField="CateID" />
		</SelectParameters>
	</asp:ObjectDataSource>
	
	
	
	 
</asp:content>
